<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../common/tagInclude.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
	<base href="${basePath}" />
	<title>文章列表--${enJoinus}</title>
	<META http-equiv="content-type" content="text/html; charset=UTF-8">
	<LINK href="${basePath}styleAdmin/css/portalinabox.css" type="text/css" rel="stylesheet">		
	<meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
   <meta http-equiv="expires" content="0">
	<script type="text/javascript" src="${basePath}styleAdmin/js/prototype-1.6.0.3.js"></script>
	<script type="text/javascript" src="${basePath}styleAdmin/js/common.js"></script>
	<script type="text/javascript">
		function edit(newsId,relId){
			window.location = '${basePath}admin/news/showUpdate?newsId='+newsId + '&relId=' + relId;
		}
		function doQuery(){
			document.myform.jsp = "${basePath}admin/joinus/list";
			document.myform.submit();
		}
		function moveToDestbin(relId){
			if(!confirm('删除文章后，文章将暂时放入垃圾箱中!')) return;
			window.location = '${basePath}admin/news/setDestbin?relIds='+relId + "&flag=1";
		}
		function setDestbin(itemName){
			var all_checkbox = document.getElementsByName(itemName);
			var len = all_checkbox.length;
			if(isChecked(itemName) == false ){
				alert('至少选择一项');
			}else{
				if(!confirm('确认要删除指定文章'))return;
				var values = "";
				for(var i=0;i<len ;i++){
					if(all_checkbox[i].checked)
						values += "," + all_checkbox[i].value;
				}
				if(values.length > 1)
					values = values.substring(1);
				window.location = '${basePath}admin/news/setDestbin?flag=1&relIds=' + values;
			}
		}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
<form action="" method="get" name="myform">
<%@include file="../../common/navigate.jsp" %>
<table width="96%" border="0" align="center" cellpadding="0" style="margin-top:5px;" cellspacing="0">
	<tr>
		<td valign="top">
			<!-- 搜索栏 -->
			<table width="100%" border="1" class="mainFunctionTable"  cellpadding="0" cellspacing="1">
				<tr height="25" class="pLabel">
			   		<td class="td_nwarpstyle">&nbsp;&nbsp;${enJoinus }</td>
			 	</tr>
				<tr>
			   		<td width="100%" height="25">
			   			<table width="100%" border="0" cellspacing="1">
			     			<tr>
			       				<td>&nbsp;&nbsp;关键字&nbsp;&nbsp;<input type=text name="keywords" value="${query.keywords}" />&nbsp;&nbsp;
									所属语种&nbsp;&nbsp;<select name="languageId" id="languageId">
				         				<option value="0">请选择</option>
										<c:forEach items="${languageInfoList}" var="languageInfo">
					         					<option value="${languageInfo.id}" <c:if test="${languageInfo.id == query.languageId}">selected</c:if>>${languageInfo.name}</option>
					         			</c:forEach>
			         				</select>
			         				&nbsp;&nbsp;发布者&nbsp;&nbsp;<select name="userId" id="userId" <c:if test="${userInfoSession.roleId != adminRoleId}">disabled="disabled"</c:if>>
				         				<option value="0">全部</option>
										<c:forEach items="${userInfoList}" var="userInfo">
			         						<option value="${userInfo.id}" <c:if test="${userInfo.id == query.userId}">selected</c:if>>${userInfo.realName}</option>
				         				</c:forEach>
			         				</select>
			         				&nbsp;&nbsp;栏目&nbsp;&nbsp;<select name="channelId" id="channelId">
			         					<option value="enJoinusChannelId" <c:if test="${enJoinusChannelId == channelId}">selected</c:if>>${enJoinus}</option>
										<c:forEach var="clSel" items="${channelInfoList}">
											<option value="${clSel.channelId}" <c:if test="${clSel.channelId == channelId}">selected</c:if>>${clSel.channelName}</option>
										</c:forEach>
			         				</select>
			       				</td>
			       				<td align="right">
			       					<a href="javascript:doQuery();"><img src="${basePath}styleAdmin/images/button/query.gif" border="0"/></a>
									<c:if test="${fmtString:isContainsInList('3041',userRightsSession) }">
			       					&nbsp;&nbsp;&nbsp;&nbsp;<a href="${basePath}admin/news/showInsert" id="lnkAdd"><img src="${basePath}styleAdmin/images/button/addNew.gif" border="0"></a>
			       					</c:if>
			        			</td>
			     			</tr>
			    		</table>
			    	</td>
			   </tr>
			 </table>
		  </td>
	  </tr>
	  <tr>
	    <td>
	    	&nbsp;&nbsp;<a href="javascript:checkAll('relId',true);">全选</a>
			&nbsp;&nbsp;<a href="javascript:checkAll('relId',false);">全不选</a>
			<c:if test="${fmtString:isContainsInList('3042',userRightsSession) }">
			&nbsp;&nbsp;[<a href="javascript:setDestbin('relId');">删除所选</a>]
			</c:if>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<tr height=25 class="pLabel" align="center">
					<td width="3%" class="td_nwarpstyle" >标识</td>
					<td width="15%" class="td_nwarpstyle">文章标题</td>
					<td width="8%" class="td_nwarpstyle">发布者</td>
					<td width="10%" class="td_nwarpstyle">来源</td>
					<td width="5%" class="td_nwarpstyle" >语种</td>
					<td width="10%" class="td_nwarpstyle" >所属栏目</td>
					<td width="4%" class="td_nwarpstyle">详情</td>
					<td width="5%" class="td_nwarpstyle" align="center">操作</td>
				</tr>
			</table>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<c:forEach items="${newsDTOList}" var="newsDTO" varStatus="status">
   					<c:choose>
   						<c:when test="${status.index % 2 == 0 }"><c:set var="css" value="c1" /></c:when>
   						<c:otherwise><c:set var="css" value="c2" /></c:otherwise>
   					</c:choose>
					<tr class="${css}">
						<td width="3%"   height="25" align="center"><input type="checkbox" name="relId" id="relId" value="${newsDTO.rel.id}"/></td>
						<td width="15%"><a href="${basePath}joinus?chId=${newsDTO.rel.channelnfo.channelId}" target="_blank">${newsDTO.newsInfo.title}</a></td>
						<td width="8%" align="center">${newsDTO.newsInfo.author}</td>
						<td width="10%">${newsDTO.newsInfo.from}</td>
						<td width="5%" align="center">${languageMap[newsDTO.newsInfo.languageId]}</td>
						<td width="10%">${newsDTO.rel.channelnfo.channelName}</td>
						<td width="4%" align="center"><a href="${basePath}joinus?chId=${newsDTO.rel.channelnfo.channelId}" target="_blank">详情</a></td>
						<td width="5%" align="center">
							<c:choose>
								<c:when test="${fmtString:isContainsInList('3043',userRightsSession) }">
									<a href="javascript:edit(${newsDTO.newsInfo.newsId},${newsDTO.rel.id});"><img src="${basePath}styleAdmin/images/edit.gif" border="0" title="编辑"/></a>
								</c:when>
								<c:otherwise>
									<a href="${basePath}admin/news/noRight"><img src="${basePath}styleAdmin/images/edit.gif" border="0" title="编辑"/></a>
								</c:otherwise>
							</c:choose>
							&nbsp;&nbsp;
							<c:choose>
								<c:when test="${fmtString:isContainsInList('3042',userRightsSession) }">
									<a href="javascript:moveToDestbin(${newsDTO.rel.id});"><img src="${basePath}styleAdmin/images/delete.gif" border="0" title="删除"/></a>
								</c:when>
								<c:otherwise>
									<a href="${basePath}admin/news/noRight"><img src="${basePath}styleAdmin/images/delete.gif" border="0" title="删除"/></a>
								</c:otherwise>
							</c:choose>
						</td>
					</tr>
				</c:forEach>
	  		</table>
		 </td>
	   </tr>
	   <tr>
		   <td height=25>
		   	<c:set var="pageURL" value="${basePath}admin/joinus/list?languageId=${query.languageId}&keywords=${fmtString:encoder(query.keywords)}&channelId=${channelId}&"/>
			<%@include file="../../common/page.jsp"%>
		  </td>
	  </tr>
</table>
</form>
</body>
</HTML>